package com.sbpm.crmbpm.client.handlers;

import com.sbpm.crmbpm.client.forms.companies.CompanyForm;
import com.sbpm.crmbpm.client.grid.CompanyGrid;
import com.sbpm.crmbpm.shared.data.client.Company;
import com.sencha.gxt.widget.core.client.event.RowDoubleClickEvent;

public class EditCompanyDoubleClickHandler implements RowDoubleClickEvent.RowDoubleClickHandler
{

    private CompanyGrid companyGrid;
    private CompanyForm companyForm;

    public EditCompanyDoubleClickHandler( CompanyGrid companyGrid, CompanyForm companyForm )
    {
        this.companyGrid = companyGrid;
        this.companyForm = companyForm;
    }

    @Override
    public void onRowDoubleClick( RowDoubleClickEvent event )
    {
        Company company = companyGrid.getSelectionModel().getSelectedItem();
        companyForm.reset();
        companyForm.show( company.getId() );

    }
}
